package cn.iocoder.boot;

import cn.iocoder.boot.eos.service.trace.TraceService;
import net.sf.json.JSONObject;
import yudao.btc.eos.EosModel;
import yudao.btc.eos.EosUtils;

import javax.annotation.Resource;
import java.util.List;

//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
public class Main {
    @Resource
    private TraceService traceService;

    public static void main(String[] args) {

        JSONObject params = new JSONObject();
        params.put("username", "admin");
        params.put("password", "admin");
        //获取最新的EOS交易信息，账户：okxeoswltxga
        List<EosModel> eosModelList = EosUtils.getEosBlock("okxeoswltxga", 0, params);
        Integer last = eosModelList.get(0).getLast();
        while (last > 0 || last >= 20) {
            List<EosModel> eosModelListTemp = EosUtils.getEosBlock("okxeoswltxga", last, params);
            last = eosModelListTemp.get(0).getLast();
            for (EosModel eosModelTemp : eosModelListTemp) {
                eosModelList.add(eosModelTemp);
            }
        }

        System.out.println(eosModelList);

    }
}